package org.rambadger.command.command;

import org.axonframework.commandhandling.annotation.TargetAggregateIdentifier;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import org.rambadger.command.validation.UrlIdentifier;

import javax.validation.constraints.NotNull;

/**
 * {@link org.rambadger.command.command Command} class for altering a {@link org.rambadger.command.model.UserAggregate User's} email address.
 */
public class ChangeUserEmail {
    @TargetAggregateIdentifier
    private final String username;
    private final String emailAddress;

    /**
     * Instantiates a new ChangeUserEmail command
     *
     * @param username the username
     * @param email the new email address
     */
    public ChangeUserEmail(String username, String email) {
        this.username = username;
        this.emailAddress = email;
    }

    /**
     * Gets the username associated with the profile being updated.
     *
     * @return the username
     */
    @UrlIdentifier @NotNull
    public String getUsername() {
        return username;
    }

    /**
     * Gets the new email address.
     *
     * @return the new email address
     */
    @Email @NotBlank
    public String getEmailAddress() {
        return emailAddress;
    }
}
